<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div:first-child {
            position: relative;
            width: 200px;
            height: 200px;
            background-color: pink;
            transform: translate(200px, 0);
        }

        div:last-child {
            position: relative;
            width: 200px;
            height: 200px;
            background-color: pink;
            transform: translate(50%, 50%);

        }

        p {
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -50px;
            margin-left: -50px;
            width: 100px;
            height: 100px;
            background-color: purple;
        }

        div:last-child div {
            position: absolute;
            width: 50px;
            height: 50px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: purple;
        }
    </style>
</head>

<body>
    <div>
        <p></p>
    </div>
    <div>
        <div></div>
    </div>
</body>

</html>